\defmodule {Chrono}

The \class{Chrono} class extends the 
\externalclass{umontreal.iro.lecuyer.util}{AbstractChrono} 
class and computes the CPU time for the current thread only.
This is the simplest way to use chronos. Classes \texttt{AbstractChrono},
\externalclass{umontreal.iro.lecuyer.util}{SystemTimeChrono}, 
\externalclass{umontreal.iro.lecuyer.util}{GlobalCPUTimeChrono} and 
\externalclass{umontreal.iro.lecuyer.util}{ThreadCPUTimeChrono} 
provide different chronos implementations.
See these classes to learn more about SSJ chronos, if problems appear with
class \texttt{Chrono}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bigskip\hrule
\begin{code}
\begin{hide}
/*
 * Class:        Chrono
 * Description:  computes the CPU time for the current thread only
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Universite de Montreal
 * Organization: DIRO, Universite de Montreal
 * @author       Éric Buist
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   <a href="http://www.gnu.org/licenses">GPL licence site</a>.
 */
\end{hide}
package umontreal.iro.lecuyer.util;


public class Chrono extends AbstractChrono \begin{hide} {
   private ThreadCPUTimeChrono chrono = new ThreadCPUTimeChrono();

   protected void getTime (long[] tab) {
         chrono.getTime(tab);
   }\end{hide}
\end{code}

%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Constructor}

\begin{code}

   public Chrono()\begin{hide} {
      chrono.init();
      init();
   }\end{hide}
\end{code}
  \begin{tabb} Constructs a \texttt{Chrono} object and
    initializes it to zero. 
  \end{tabb}


%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection*{Methods}

\begin{code}

   public static Chrono createForSingleThread ()\begin{hide} {
         return new Chrono();
   }\end{hide}
\end{code}
\begin{tabb}
   Creates a \texttt{Chrono} instance adapted for a program
   using a single thread.  Under Java 1.5, this method returns
   an instance of \class{ChronoSingleThread} which can
   measure CPU time for one thread.  Under Java versions prior to
   1.5, this returns an instance of this class.
   This method must not be used to create a timer for a
   multi-threaded program, because the obtained CPU times
   will differ depending on the used Java version.
\end{tabb}
\begin{htmlonly}
   \return{the constructed timer.}
\end{htmlonly}
\begin{code}
\begin{hide}
}\end{hide}
\end{code}
